<template>
  <span>
   <el-button type="primary" size="small" @click="dialogFormVisible = true" class="index" >
      修改</el-button>
    <el-dialog :append-to-body='true'  title="收货地址" :visible.sync="dialogFormVisible">
      <el-form :model="form">
        <el-form-item label="标题" :label-width="formLabelWidth">
          <el-input v-model="form.title" autocomplete="off" size="small"></el-input>
        </el-form-item>
        <el-form-item label="作者" :label-width="formLabelWidth">
          <el-input v-model="form.writter" autocomplete="off" size="small"></el-input>
        </el-form-item>
        <el-form-item label="发布时间" :label-width="formLabelWidth">
          <el-date-picker size="small" v-model="form.value1" type="datetime" placeholder="选择日期"></el-date-picker>
        </el-form-item>
        <el-form-item label="景区介绍" :label-width="formLabelWidth">
          <el-input
            type="textarea"
            :autosize="{ minRows: 2, maxRows: 4}"
            placeholder="请输入内容"
            v-model="form.textarea3"
          ></el-input>
        </el-form-item>
        <el-form-item label="图片上传" :label-width="formLabelWidth">
          <el-upload
            action="http://trip.com/reception/tripContent/pic"
            list-type="picture-card"
            :on-preview="handlePictureCardPreview"
            :on-remove="handleRemove"
            :on-success="getdata"
          >
            <i class="el-icon-plus"></i>
          </el-upload>
          <el-dialog :visible.sync="dialogVisible">
            <img width="100%" :src="form.dialogImageUrl" alt>
          </el-dialog>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="dialogFormVisible = false">取 消</el-button>
        <el-button type="primary" @click="handlePut(form)">
          <span @click="dialogFormVisible = false">确 定</span>
        </el-button>
      </div>
    </el-dialog>
  </span>
</template>

<script>
import axios from 'axios'
export default {
  name: 'addTripContent',
  data () {
    return {
      dialogFormVisible: false,
      dialogVisible: false,
      form: {
        writter: '',
        title: '',
        delivery: false,
        value1: '',
        textarea3: '',
        dialogImageUrl: '',
        imgurl: [],
        imgname: []
      },
      formLabelWidth: '120px',
      pic_name: [],
      pic_url: []
    }
  },
  methods: {
    handlePut () {
      var id = this.$store.state.data
      console.log(this.$store.state.data)
      // var idArray={name:this.form.name,tele:this.form.tele};
      // var str = JSON.stringify(idArray);
      // console.log(idArray);
      axios.put(`http://trip.com/reception/adminUsers/put/${id}`, { name: this.form.name, tele: this.form.tele }).then(response => {
        console.log(response)
      })
      // this.tableData = this.tableData.filter(i => !idArray.includes(i.id));
    }
  }
}

</script>

<style>
.index{
 margin-left: 10px;
 z-index:3;
}
.s{
  z-index: 3000;
}
.pad {
  padding-right: 20px;
}
</style>
